<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录界面</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<div>
    <h1>登录界面</h1>
    <button id="logout">登出</button>
    <form method="post">
        {% csrf_token %}
        {% for item in form %}
            <label for="{{ item.id_for_label }}">{{ item.label }}</label>
            {{ item }}
            {{ item.errors.0 }}
        {% endfor %}
        <input type="submit" value="登录">
    </form>
</div>
<script>
    $(function(){
        $('#logout').click(function(){
            $.ajax({
                url: '/auth/logout',
                type: 'GET',
                success: function(){
                    alert('logout!')
                }
            })
        })
    })
</script>
</body>
</html>